'call MakeAppData(1)
dim siteMapstr,nowCatid,catObj,CatChilds,IPageLoop
nowCatid= Tpl.GetValue("SectedID")

Tpl.Assign "CatThisID",nowCatid
siteMapstr= "<Nodes>"
siteMapstr=siteMapstr & "<Node><name>首页</name><href>"& Tpl.GetValue("BaseURI") &"</href></Node>"
siteMapstr=siteMapstr & GetPathXml( nowCatid )
siteMapstr=siteMapstr & "</Nodes>"

call Tpl.AssignStr("YourSiteBar",siteMapstr, "cache\xsl\yoursite.xsl")

Tpl.Assign "CataBar",OutCatalogeBar(killint(Tpl.GetValue("SectedID"),0,0,5),"ID")

Dim oInfo,allResults
Set oInfo = new Info
oInfo.PInfoMdb	= ConstDBtablearr(1)
oInfo.pPageLimit=  FrontDirPageList 

CatChilds= GetWithChildsInIDs( Tpl.GetValue("CatThisID"))
allResults=oInfo.GetAllResult( CatChilds)

IPageLoop = killint(Tpl.GetValue("PageID"),1,1,10)


call Tpl.AssignStr("RelativeReplyLists",GetTopReply(10,24,NoReplyList,  replace(replace(CatChilds,")",""),"(","" )), "cache\xsl\top-reply.xsl")



Tpl.Assign "Title", GetCatName( Tpl.GetValue("CatThisID") ) & " - " & IniTitle
if(Tpl.GetValue("MustPageAll")  = true ) then 
	dim newI,allPageCount,toPage

	allPageCount =  GetPageCount(allResults,oInfo.pPageLimit)
	toPage = allPageCount
	if( IsInteger(Tpl.GetValue("StopPageNumber")) ) then 
		if(killint(Tpl.GetValue("StopPageNumber"),1,1,10) < toPage) then toPage= killint(Tpl.GetValue("StopPageNumber"),1,1,10)
	end if 
	for newI = IPageLoop to toPage
		Tpl.AssignStr "InfoList", oInfo.GetXmlInfoList( newI ,CatChilds) ,"cache\xsl\infolist.xsl"
		
		Tpl.Assign "PageInfoDetails"," 分页信息 ： " & GetDirIndexPageInfo(newI, oInfo.pPageLimit , allResults, IIF(NeedHtmlPage,GetCatlogueURLPath(Tpl.GetValue("SectedID")) & "/index-{0}.html", BaseURI & "sort.asp?id=" & CatChilds & "&page={0}") ,10)

		if NeedHtmlPage then Call WriteTo(Tpl.GetValue("BasePath") &  "\" & Replace(GetCataloguePath( Tpl.GetValue("SectedID") ),"/","\") & "\index-"& (allPageCount - newI +1) &".html"  ,Tpl.Fetch("cache\cemplate\dir-index.html"))




	next 
end if 


Tpl.AssignStr "InfoList", oInfo.GetXmlInfoList(killint(Tpl.GetValue("PageID"),1,1,10) ,CatChilds) ,"cache\xsl\infolist.xsl"
Tpl.Assign "PageInfoDetails"," 分页信息 ： " & GetDirIndexPageInfo(IPageLoop, oInfo.pPageLimit , allResults, IIF(NeedHtmlPage,GetCatlogueURLPath(Tpl.GetValue("SectedID")) & "/index-{0}.html", BaseURI & "sort.asp?id=" & CatChilds & "&page={0}") ,10)
if NeedHtmlPage then Call WriteTo(Tpl.GetValue("BasePath") &  "\" & Replace(GetCataloguePath( Tpl.GetValue("SectedID") ),"/","\") & "\index.html"  ,Tpl.Fetch("cache\cemplate\dir-index.html"))


